package com.itheima.night.demo04;

public class MyThread implements Runnable {
    private volatile int count = 0;
    private Object lock = new Object();
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            synchronized (lock) {
                count++;
                System.out.println("已经送了" + count + "个冰淇淋了");
            }
        }
    }
}
